package com.pdg.mcplugin.invisiblehand.commandprocessors;

public enum CommodityProperty {
	BASE_PRICE("BASE-PRICE","Base Price"),
	BASE_SUPPLY("BASE-SUPPLY","Base Supply"),
	BASE_DEMAND("BASE-DEMAND","Base Demand"),
	SUPPLY_FACTOR("SUPPLY-FACTOR","Supply Factor"),
	DEMAND_FACTOR("DEMAND-FACTOR","Demand Factor"),
	MARK_UP("MARK-UP","Mark Up"),
	SALES_COUNT("SALES-COUNT","Sales Count"),
	PURCHASE_COUNT("PURCHASE-COUNT","Purchase Count"),
	STOCK("STOCK","Stock"),
	ENABLED("ENABLED","Enabled"),
	COMMODITY_NAME("COMMODITY-NAME","Commodity Name"),
	WORLD_NAME("WORLD-NAME","World Name"),
	MATERIAL_TYPE_ID("MATERIAL-TYPE-ID","Material Type Id"),
	MATERIAL_DATA("MATERIAL-DATA","Material Data"),
	INVALID(null,null);
	private String text;
	private String label;

	CommodityProperty(String theText,String theLabel){
		setText(theText);
		setLabel(theLabel);
	}

	private void setLabel(String theLabel) {
		label = theLabel;
	}

	private void setText(String theText) {
		text = theText;
	}
	
	public String getText(){
		return text;
	}
	
	public String getLabel(){
		return label;
	}
	
	private static final CommodityProperty[] properties = new CommodityProperty[]{
		BASE_PRICE,BASE_SUPPLY,BASE_DEMAND,SUPPLY_FACTOR,DEMAND_FACTOR,MARK_UP,SALES_COUNT,PURCHASE_COUNT,STOCK,ENABLED,COMMODITY_NAME,WORLD_NAME,MATERIAL_TYPE_ID,MATERIAL_DATA
	};
	
	public static CommodityProperty parse(String theText){
		for(int index=0;index<properties.length;++index){
			if(properties[index].getText().compareToIgnoreCase(theText)==0){
				return properties[index];
			}
		}
		return INVALID;
	}
}
